package cn.it.hbtt.dao;

import cn.it.hbtt.entity.User;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDaoImpl extends BaseDAO implements UserDao {
    private Connection conn;


    @Override
    public User login(User user) {

        try {
            super.getConnection();
            String sql="select *  from student where name=? and password=?";

            PreparedStatement sql1 = conn.prepareStatement("sql");

            sql1.setObject(1, user.getUsername());
            sql1.setObject(2,user.getPwd());
            ResultSet resultSet = sql1.executeQuery();
            User loginUser=null;
            if(resultSet.next()){
                loginUser = new User();
                loginUser.setUsername(resultSet.getString("name"));
                loginUser.setPwd(resultSet.getString("password"));
            }



        } catch (SQLException e) {
            e.printStackTrace();
        }

        return null;
    }
}
